package netty.buffer;

import sun.awt.image.BufferedImageGraphicsConfig;

import java.nio.Buffer;
import java.nio.ByteBuffer;

/**
 * @author cyt
 * @create 2020-11-04 14:37
 */
public class TestB {

    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(10);
        for (int i = 0; i < 10; i++) {
            buffer.put((byte) i);
        }

        ByteBuffer readOnlyBuffer = buffer.asReadOnlyBuffer();
        System.out.println(readOnlyBuffer.getClass());

        while (readOnlyBuffer.hasRemaining()) {
            System.out.println(readOnlyBuffer.get());
        }


        readOnlyBuffer.put("test".getBytes());
    }
}
